package LeetCode.month02.day52;

public class No100 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if(p==null&&q==null) return true;
        if(p!=null&&q!=null) {
            if (p.val != q.val) return false;
            if (!isSameTree(p.left, q.left)) return false;
            if (!isSameTree(p.right, q.right)) return false;
            return true;
        }
        return false;
    }
}
